package org.elkastud.model;

import java.util.Iterator;
import java.util.List;

/**
 * Implements model's in-devel test runs
 * @author Jakub Skierbiszewski
 */

public class ModelTest
{

	public static void run()
	{
		System.out.println("Hello!");
		DNASequence a = new DNASequence("GTCCAACGTCCAACGTCCAACGTCCAACGTCCAACGTCCAACGTCCAACGTCCAACGTCCAACGTC"
				+ "CAACGTCCAACGTCCAACGTCCAACGTCCAACGTCCAACGTCCAAC"
				+ "CAACGTCCAACGTCCAACGTCCAACGTCCAACGTCCAACGTCCAAC"
				+ "CAACGTCCAACGTCCAACGTCCAACGTCCAACGTCCAACGTCCAAC"
				+ "CAACGTCCAACGTCCAACGTCCAACGTCCAACGTCCAACGTCCAAC");
		DNASequence b = new DNASequence("AGCCGAAGCCGAATCACCATAGGGACATAGGGACATAGGGAATCACCATATCACCATGCCG"
				+ "GAATCACCATAGGGACATAGGGACATAGGGAATCACCATATCACCATGCC"
				+ "GAATCACCATAGGGACATAGGGACATAGGGAATCACCATATCACCATGCC"
				+ "GAATCACCATAGGGACATAGGGACATAGGGAATCACCATATCACCATGCC"
				+ "GAATCACCATAGGGACATAGGGACATAGGGAATCACCATATCACCATGCCAAGCCGAAT");
		DNASequence c = new DNASequence("AAACCATAGGGACATAGGGACATCATAGGGACACCATA"
				+ "ACATCATAGGGACACCATAGGGACAAACT"
				+ "ACATCATAGGGACACCATAGGGACAAACT"
				+ "ACATCATAGGGACACCATAGGGACAAACT"
				+ "ACATCATAGGGACACCATAGGGACAAACTGGGACAAACTGA");


		DNASequence s1 = new DNASequence("-");
		DNASequence s2 = new DNASequence("GAAG");
		DNASequence s3 = new DNASequence("AAG");

		// SW tests
		long startTime = System.currentTimeMillis();
		System.out.println("Starting SmithWatermanMatch3...");
		SmithWatermanMatch3 matchSW3 = new SmithWatermanMatch3(a,b,c);
		List<MatchResult3> resultList = matchSW3.doCalculate(20);
		for(Iterator it = resultList.iterator(); it.hasNext();)
		{
			MatchResult3 tmp = (MatchResult3)it.next();
			System.out.println("Smith-Waterman local alignment scored "+ tmp.getScore());
			System.out.println(tmp.getSequenceA());
			System.out.println(tmp.getSequenceB());
			System.out.println(tmp.getSequenceC());
		}
		
		// NW test
		System.out.println("Starting NeedlemanWunchMatch3...");
		NeedlemanWunchMatch3 match3 = new NeedlemanWunchMatch3(a,b,c);
		MatchResult3 result = match3.doCalculate();
		System.out.println("Results NW:");
		System.out.println(result.getSequenceA());
		System.out.println(result.getSequenceB());
		System.out.println(result.getSequenceC());

		long endTime = System.currentTimeMillis();
		System.out.println("Done. Time: "+ (endTime-startTime));
	}

}
